const moment = require('moment')
require('moment-timezone')
moment.locale('zh-cn')

// 通用格式化封装方法
function momentDateTime(time = Date.now(), format = 'YYYY-MM-DD HH:mm:ss') {
  return moment(time).tz('Asia/Shanghai').format(format)
}

// 返回moment对象
function momentHelper(time = Date.now()) {
  return moment(time).tz('Asia/Shanghai')
}

module.exports = {
  momentDateTime,
  momentHelper
}
